#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back

using namespace std;

using pii = pair < int , int >;
using vec = vector < int >;
using veg = vector < pii >;
using ll = long long;
using db = double;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 2e5 + 10;

int a[N],cur,n,K;
bool vis[N];

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
	n = in; K = in;
	for(int i = 1;i <= K;i++) a[i] = in;
	int cur = 1;
	for(int i = 1;i <= K - 1;i++) {
		if(a[i] == cur) printf("%d ",cur),vis[cur] = true;
		else printf("%d %d ",a[i],cur),vis[a[i]] = vis[cur] = true;
		while(vis[cur]) cur++;
	}
	for(int i = n;i >= 1;i--) if(!vis[i]) printf("%d ",i); puts(""); return 0;
}
